﻿using System;
namespace Kis.Xroad.Eu {
    
    
    [global::Xtee.Core.Attributes.XmlTypeAttribute(Name="Registrikood", Namespace="http://kis.x-road.eu/", Target=typeof(Registrikood))]
    public class RegistrikoodSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
        
        protected Registrikood clazz;
        
        public RegistrikoodSerializer(Registrikood clazz) {
            this.clazz = clazz;
        }
        
        public override void WriteXmlAttributes(global::Xtee.Core.IXteeXmlWriter Writer) {
            base.WriteXmlAttributes(Writer);
        }
        
        public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
            base.WriteXml(Writer);
            if (clazz.Registrikood0!=null) {
                Writer.WriteStartElement("Registrikood");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdInt(((int)(clazz.Registrikood0))).ToString());
                Writer.WriteEndElement();
            }
        }
        
        public override void ReadXmlAttributes(global::Xtee.Core.IXteeXmlReader Reader) {
            base.ReadXmlAttributes(Reader);
        }
        
        public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
            base.ReadXml(Reader);
            if (Reader.LocalName=="Registrikood") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>Registrikood>Registrikood");
                }
                clazz.Registrikood0 = new global::Xtee.Core.Schema.XsdInt(Reader.ReadElementString("Registrikood")).Value;
            }
        }
    }
}
